var mysql = require('mysql');
var util = require('util');

function getConnection(){
  var client = mysql.createConnection({
    host: 'localhost',
    user: 'root',
    password: '080910',
    database: 'myapp'
  });
  return client;
}

function getDataFromTableTest(client,callback){
  var selectstatement = 'select * from test';
  client.query(selectstatement, function(errs,rows,fields){
      if (errs){
        callback(errs);
      }
      if (rows){
        console.log(rows);
        callback(rows);
    }
  });
}

exports.getConnection = getConnection;
exports.getDataFromTableTest = getDataFromTableTest;


